var _o52;
var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2ConstValue = require("ConstValue");
var $2GameEvent = require("GameEvent");
var r = cc._decorator.ccclass;
var def_KS_InterstitialMgr = _o52 = /* */function () {
  function _ctor() {
    babel_classCallCheck(this, _ctor);
    this.interstitialAd = null;
  }
  return babel_createClass(_ctor, [{
    key: "init",
    value: function init() {}
  }, {
    key: "show",
    value: function show(e) {
      console.log(" KS_InterstitialMgr show", e);
      if (window.ks) {
        var _t23 = {
          adUnitId: e
        };
        this.interstitialAd = window.ks.createInterstitialAd(_t23);
        if (this.interstitialAd) {
          this.interstitialAd.onClose(function () {
            $2ConstValue.ConstValue.InterAdIntervalTime += $2ConstValue.ConstValue.INSERT_VIDEO_INTERVAL_KS;
          });
          this.interstitialAd.onError(function () {});
          this.interstitialAd.show().then(function (e) {
            $2GameEvent.default.sendEvent("interstitial_show");
            console.log("show interstitial ad success, result is ".concat(e));
          }).catch(function (e) {
            console.log("show interstitial ad failed, error is ".concat(e));
            e.code;
          });
        } else {
          console.log("创建插屏广告组件失败");
        }
      }
    }
  }, {
    key: "close",
    value: function close() {
      if (this.interstitialAd) {
        this.interstitialAd.offClose(this.close.bind(this));
        this.interstitialAd.destroy();
        this.interstitialAd = null;
      }
    }
  }], [{
    key: "Instance",
    get() {
      _o52._instance || (_o52._instance = new _o52());
      return _o52._instance;
    }
  }]);
}();
def_KS_InterstitialMgr = _o52 = cc__decorate([r], def_KS_InterstitialMgr);
exports.default = def_KS_InterstitialMgr;